home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / internet / weblibev / weblibdp.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-10-03  |  14.6 KB  |  487 lines

  1. { =============================================================================
  2.   Copyright 1995 by Potomac Software, Inc. Use of this material is subject to
  3.   the terms and conditions of the software license agreement.
  4.        
  5.   WEBLIBDP.PAS: Contains Delphi declarations for WebLib (TM).         
  6.   ============================================================================== }
  7.   
  8. unit Weblib;
  9.  
  10. { ========== INTERFACE ========== }
  11.  
  12. interface
  13.     uses WinTypes;
  14.  
  15. { ========== Flags that may be passed to API functions ========== }
  16.  
  17. { Flags for ConnectBrowser }
  18. const 
  19.     WL_STARTBROWSER    = $1;                      { start browser if not running }
  20.     WL_SENDMESSAGE = $2;                     { notify caller via SendMessage }
  21.     WL_POSTMESSAGE = $4;                    { notify caller via PostMessage }
  22.  
  23. { Flags for ListWindows }
  24. const
  25.     WL_FIRSTWINDOW = True;                    { get first window }
  26.     WL_NEXTWINDOW = False;                    { get next window (if any) }
  27.  
  28. { Flags for GetWindowInfo, ActivateWindow and OpenURL }
  29. const
  30.     WL_ACTIVEWINDOW    = $FFFFFFFF;            { operate on active window }
  31.     WL_LASTACTIVEWINDOW = $FFFFFFFF;         { activate last active window }
  32.     WL_NEWWINDOW = $0;                        { create new window for URL }
  33.  
  34. { Flags for SetWindowPos }
  35. const
  36.     WL_NOCHANGE    = $FFFFFFFF;                { do not change x, y, width, height }
  37.  
  38. { Flags for ShowWindow }
  39. const
  40.     WL_MINIMIZE    = $1;                        { minimize window }
  41.     WL_MAXIMIZE = $2;                        { maximize window }
  42.     WL_NORMAL = $3;                           { restore window to normal size }
  43.  
  44. { Flags for OpenURL, values must conform to DDE API }
  45. const
  46.     WL_NODOCUMENTCACHE = $1;                { ignore browser's doc cache }
  47.     WL_NOIMAGECACHE    = $2;                    { ignore browser's image cache }
  48.     WL_BACKGROUNDMODE = $4;                    { operate in background mode }
  49.  
  50. { Flags that may be passed instead of notification window handle }
  51. const
  52.     WL_DEFAULTNOTIFY = -1;                    { use default from SetDefaultNotify }
  53.     WL_NONOTIFY    = 0;                         { do not send notification message }
  54.  
  55. { Flags for UnRegisterURLEcho and others }
  56. const
  57.     WL_UNREGISTERALL = 0;                    { unregister all windows }
  58.  
  59. { Flags for RegisterViewer, values must conform to DDE API }
  60. const
  61.     WL_SHELLEXECUTE    = $1;                    { launch viewer using ShellExecute }
  62.     WL_QUERYVIEWER = $2;                    { send event to query filename }
  63.     WL_VIEWDOCFILE = $4;                    { send event to view filename }
  64.  
  65. { Flags for AddToolbarButton }
  66. const
  67.     WL_BITMAPHANDLES = 0;                    { passing bitmaps, not resource IDs }
  68.  
  69. { Flags for SetToolbarText }
  70. const
  71.     WL_TOOLBARTEXT = -1;                    { set toolbar text, not button text }
  72.  
  73. { Flags for SetToolbarFont }
  74. const
  75.     WL_TOOLBARFONT = $1;                    { set font for toolbar text }
  76.     WL_BUTTONFONT = $2;                        { set font for button text }
  77.  
  78. { Flags for SetToolbarTextColor }
  79. const
  80.     WL_TOOLBARTEXTCOLOR = $1;                { set color for toolbar text }
  81.     WL_BUTTONTEXTCOLOR = $2;                { set color for button text }
  82.  
  83. { ========== Notification events generated by API ========== }
  84.  
  85. const
  86.     WLN_BEGINPROGRESS = $1;
  87.     WLN_SETPROGRESSRANGE = $2;
  88.     WLN_MAKINGPROGRESS = $3;
  89.     WLN_ENDPROGRESS    = $4;
  90.     WLN_FINISHED = $5;
  91.     WLN_CANCELED = $6;
  92.     WLN_URLECHO    = $7;
  93.     WLN_OPENURL    = $8;
  94.     WLN_CANCELTRX = $9;
  95.     WLN_WINDOWCHANGE = $a;
  96.     WLN_QUERYVIEWER    = $b;
  97.     WLN_VIEWDOCFILE    = $c; 
  98.     WLN_BUTTONCLICKED = $d;
  99.     WLN_BROWSERSTART = $e;
  100.     WLN_BROWSEREXIT    = $f;
  101.  
  102. { ========== Flags for WindowChange notification event ========== }
  103.  
  104. const
  105.     WLF_MOVESIZE = $1;
  106.     WLF_MAXIMIZED = $2;
  107.     WLF_NORMALIZED = $4;
  108.     WLF_MINIMIZED = $8;
  109.     WLF_CLOSED = $10;
  110.     WLF_EXITING    = $10000;
  111.     
  112. { ========== APIs for extracting values from lParam in notification messages ========== }
  113.  
  114. function WLNGetTransaction(lp: LongInt) : LongInt; far;
  115. function WLNGetProgressString(lp: LongInt) : PChar; far;
  116. function WLNGetProgressValue(lp: LongInt) : LongInt; far;
  117. function WLNGetProgressMaximum(lp: LongInt) : LongInt; far;
  118. function WLNGetWindow(lp: LongInt) : LongInt; far;
  119. function WLNGetURL(lp: LongInt) : PChar; far;
  120. function WLNGetMIMEType(lp: LongInt) : PChar; far;
  121. function WLNGetReferrer(lp: LongInt) : PChar; far;
  122. function WLNGetFlags(lp: LongInt) : LongInt; far;
  123. function WLNGetSaveFile(lp: LongInt) : PChar; far;
  124. function WLNGetFormData(lp: LongInt) : PChar; far;
  125. function WLNGetX(lp: LongInt) : LongInt; far;
  126. function WLNGetY(lp: LongInt) : LongInt; far;
  127. function WLNGetWidth(lp: LongInt) : LongInt; far;
  128. function WLNGetHeight(lp: LongInt) : LongInt; far;
  129. function WLNGetFileName(lp: LongInt) : PChar; far;
  130. function WLNGetButtonID(lp: LongInt) : Word; far;
  131.  
  132. { ========== Pre-defined notification message, included for convenience ========== }
  133.  
  134. const
  135.     WM_WEBLIB_NOTIFY = 2000;
  136.  
  137. { ========== Handles returned by ConnectBrowser, CreateToolbar and AppendFormData ======== }
  138. type
  139.     HBROWSER = THandle;
  140.     HTOOLBAR = THandle; 
  141.     HFORMDATA = THandle; 
  142.  
  143. { ========== Housekeeping functions ========== }
  144.  
  145. function WLStartup : Bool; far;
  146. function WLCleanup : Bool; far;
  147.  
  148. function WLSetDefaultNotify(hwndNotify: HWnd; 
  149.     nMsg: Word) : Bool; far;
  150.  
  151. { ========== Browser API functions ========== }
  152.  
  153. function WLConnectBrowser(wOptions: Word) : HBROWSER; far;
  154.  
  155. function WLDisconnectBrowser(hBrowser: HBROWSER; 
  156.     bExit: Bool) : Bool; far;
  157.  
  158. function WLGetWindowInfo(hBrowser: HBROWSER; 
  159.     dwWindow: LongInt;
  160.     lpszURL: PChar; 
  161.     cbURL: Integer; 
  162.     lpszTitle: PChar;
  163.     cbTitle: Integer) : Bool; far;
  164.     
  165. function WLListWindows(hBrowser: HBROWSER; 
  166.     bFirst: Bool) : LongInt; far;
  167.  
  168. function WLActivateWindow(hBrowser: HBROWSER; 
  169.     dwWindow: LongInt) : LongInt; far;    
  170.     
  171. function WLCloseWindow(hBrowser: HBROWSER; 
  172.     dwWindow: LongInt) : Bool; far;
  173.  
  174. function WLSetWindowPos(hBrowser: HBROWSER; 
  175.     dwWindow: LongInt;
  176.     dwX: LongInt;
  177.     dwY: LongInt;
  178.     dwWidth: LongInt;
  179.     dwHeight: LongInt) : Bool; far;
  180.     
  181. function WLShowWindow(hBrowser: HBROWSER; 
  182.     dwWindow: LongInt;
  183.     nShow: Word) : Bool; far;
  184.  
  185. function WLShowFile(hBrowser: HBROWSER; 
  186.     lpszFile: PChar;
  187.     lpszMIMEType: PChar;
  188.     dwWindow: LongInt;
  189.     lpszURL: PChar;
  190.     hwndNotify: HWnd;
  191.     nMsg: Word) : LongInt; far;
  192.     
  193. function WLOpenURL(hBrowser: HBROWSER; 
  194.     lpszURL: PChar;
  195.     dwWindow: LongInt;
  196.     wOptions: Word;
  197.     hwndNotify: HWnd;
  198.     nMsg: Word) : LongInt; far;
  199.         
  200. function WLSaveURL(hBrowser: HBROWSER; 
  201.     lpszURL: PChar;
  202.     lpszFile: PChar;
  203.     dwWindow: LongInt;
  204.     wOptions: Word;
  205.     hwndNotify: HWnd;
  206.     nMsg: Word) : LongInt; far;
  207.  
  208. function WLPostFormData(hBrowser: HBROWSER; 
  209.     lpszURL: PChar;
  210.     dwWindow: LongInt;
  211.     lpszFormData: PChar;
  212.     lpszMIMEType: PChar;
  213.     hwndNotify: HWnd;
  214.     nMsg: Word) : Longint; far;
  215.         
  216. function WLSaveFormData(hBrowser: HBROWSER; 
  217.     lpszURL: PChar;
  218.     lpszFile: PChar;
  219.     dwWindow: LongInt;
  220.     lpszFormData: PChar;
  221.     lpszMIMEType: PChar;
  222.     hwndNotify: HWnd;
  223.     nMsg: Word) : LongInt; far;
  224.         
  225. function WLCancel(hBrowser: HBROWSER; 
  226.     dwTransaction: LongInt) : Bool; far;
  227.     
  228. function WLRegisterProtocol(hBrowser: HBROWSER; 
  229.     lpszProtocol: PChar;
  230.     hwndNotify: HWnd;
  231.     nMsg: Word) : Bool; far;
  232.     
  233. function WLUnregisterProtocol(hBrowser: HBROWSER; 
  234.     lpszProtocol: PChar;
  235.     hwndNotify: HWnd) : Bool; far;
  236.  
  237. function WLRegisterURLEcho(hBrowser: HBROWSER; 
  238.     hwndNotify: HWnd;
  239.     nMsg: Word) : Bool; far;
  240.  
  241. function WLUnregisterURLEcho(hBrowser: HBROWSER; 
  242.     hwndNotify: HWnd) : Bool; far;
  243.  
  244. function WLRegisterViewer(hBrowser: HBROWSER; 
  245.     lpszMIMEType: PChar;
  246.     wOptions: Word;
  247.     hwndNotify: HWnd;
  248.     nMsg: Word) : Bool; far;
  249.     
  250. function WLUnregisterViewer(hBrowser: HBROWSER; 
  251.     lpszMIMEType: PChar;
  252.     hwndNotify: HWnd) : Bool; far;
  253.  
  254. function WLRegisterWindowChange(hBrowser: HBROWSER; 
  255.     dwWindow: LongInt;
  256.     hwndNotify: HWnd;
  257.     nMsg: Word) : Bool; far;
  258.     
  259. function WLUnregisterWindowChange(hBrowser: HBROWSER; 
  260.     dwWindow: LongInt;
  261.     hwndNotify: HWnd) : Bool; far;
  262.  
  263. function WLParseAnchor(hBrowser: HBROWSER; 
  264.     lpszAbsoluteURL: PChar;
  265.     lpszRelativeURL: PChar) : PChar; far;
  266.     
  267. function WLGetVersion(hBrowser: HBROWSER; 
  268.     wMajor: Word;
  269.     wMinor: Word) : LongInt; far;
  270.  
  271. function WLQueryURLFile(hBrowser: HBROWSER; 
  272.     lpszFile: PChar) : PChar; far;
  273.  
  274. function WLSetNotifyMethod(hBrowser: HBROWSER; 
  275.     wMethod: Word) : Bool; far;
  276.     
  277. function WLGetTransactionWindow(hBrowser: HBROWSER; 
  278.     dwTransaction: LongInt) : LongInt; far;
  279.  
  280. procedure WLNSetFileName(lParam: LongInt;
  281.     lpszFileName: PChar); far;
  282.  
  283. { ========== Toolbar API functions ========== }
  284.  
  285. function WLCreateToolbar(lpszMenu: PChar;
  286.     hwndNotify: HWnd;
  287.     nMsg: Word) : HTOOLBAR; far;
  288.     
  289. function WLDeleteToolbar(hToolbar: HTOOLBAR) : Bool; far;
  290.  
  291. function WLIsToolbarActive(hToolbar: HTOOLBAR): Bool; far;
  292.  
  293. function WLSetActiveToolbar(hToolbar: HTOOLBAR) : Bool; far;
  294.  
  295. function WLAddToolbarButton(hToolbar: HTOOLBAR;
  296.     nID: Word;
  297.     nIdx: Integer;
  298.     lpszText: PChar;
  299.     hInstance : THandle;
  300.     lpszBitmap: PChar;
  301.     lpszBitmapSel: PChar;
  302.     lpszBitmapFocus: PChar;
  303.     lpszBitmapDisabled: PChar) : Bool; far;
  304.         
  305. function WLRemoveToolbarButton(hToolbar: HTOOLBAR;
  306.     nID: Word) : Bool; far;
  307.  
  308. function WLIsToolbarButtonVisible(hToolbar: HTOOLBAR;
  309.     nID: Word) : Bool; far;
  310.  
  311. function WLShowToolbarButton(hToolbar: HTOOLBAR;
  312.     nID: Word;
  313.     bShow: Bool) : Bool; far;
  314.  
  315. function WLEnableToolbarButton(hToolbar: HTOOLBAR;
  316.     nID: Word;
  317.     bEnable: Bool) : Bool; far;
  318.  
  319. function WLIsToolbarButtonEnabled(hToolbar: HTOOLBAR;
  320.     nID: Word) : Bool; far;
  321.  
  322. function WLGetToolbarText(hToolbar: HTOOLBAR;
  323.     nID: Word) : PChar; far;
  324.  
  325. function WLSetToolbarText(hToolbar: HTOOLBAR;
  326.     nID: Word;
  327.     lpszText: PChar) : Bool; far;
  328.  
  329. function WLGetToolbarFont(hToolbar: HTOOLBAR;
  330.     wType: Word) : HFont; far;
  331.  
  332. function WLSetToolbarFont(hToolbar: HTOOLBAR;
  333.     wType: Word;
  334.     hFont: HFont) : Bool; far;
  335.  
  336. function WLGetToolbarBkgnd(hToolbar: HTOOLBAR) : TColorRef; far;
  337.  
  338. function WLSetToolbarBkgnd(hToolbar: HTOOLBAR;
  339.     crBackground: TColorRef) : Bool; far;
  340.  
  341. function WLGetToolbarTextColor(hToolbar: HTOOLBAR;
  342.     wType: Word) : TColorRef; far;
  343.  
  344. function WLSetToolbarTextColor(hToolbar: HTOOLBAR;
  345.     wType: Word;
  346.     crText: TColorRef) : Bool; far;
  347.  
  348. { ========== Utility functions for building form data buffer for posting to URL ======== }
  349.  
  350. function WLAppendFormData(hFormData: HFORMDATA;
  351.     lpszName: PChar;
  352.     lpszData: PChar;
  353.     cbData: Word) : HFORMDATA; far;
  354.     
  355. function WLGetFormDataLength(hFormData: HFORMDATA) : Word; far;
  356.  
  357. function WLAccessFormData(hFormData: HFORMDATA;
  358.     lpszRetBuf: PChar;
  359.     cbRetBuf: Word) : Bool; far;
  360.     
  361. { ========== Weblib extension APIs for adding a toolbar button ========== }
  362.  
  363. function WLAddToolbarButtonByHandle(hToolbar: HTOOLBAR;
  364.     nID: Word;
  365.     nIdx: Integer;
  366.     lpszText: PChar;
  367.     hBitmap : HBitmap;
  368.     hBitmapSel : HBitmap;
  369.     hBitmapFocus : HBitmap;
  370.     hBitmapDisabled : HBitmap;
  371.     bCopy: Bool) : Bool; far;
  372.  
  373. function WLAddToolbarButtonByFile(hToolbar: HTOOLBAR;
  374.     nID: Word;
  375.     nIdx: Integer;
  376.     lpszText: PChar;
  377.     lpszBitmapFile: PChar;
  378.     lpszBitmapSelFile: PChar;
  379.     lpszBitmapFocusFile: PChar;
  380.     lpszBitmapDisabledFile: PChar) : Bool; far;
  381.  
  382. function WLAddToolbarButtonByID(hToolbar: HTOOLBAR;
  383.     nID: Word;
  384.     nIdx: Integer;
  385.     lpszText : PChar;
  386.     hInstance: THandle;
  387.     nBitmap: Word;
  388.     nBitmapSel: Word;
  389.     nBitmapFocus: Word;
  390.     nBitmapDisabled: Word) : Bool; far;
  391.  
  392. function WLAddToolbarButtonByName(hToolbar: HTOOLBAR;
  393.     nID: Word;
  394.     nIdx: Integer;
  395.     lpszText: PChar;
  396.     hInstance: THandle;
  397.     lpszBitmap: PChar;
  398.     lpszBitmapSel: PChar;
  399.     lpszBitmapFocus: PChar;
  400.     lpszBitmapDisabled: PChar) : Bool; far;
  401.  
  402. { ========== IMPLEMENTATION ========== }
  403.  
  404. implementation 
  405.  
  406. function WLNGetTransaction; external 'WEBLIBEX';
  407. function WLNGetProgressString; external 'WEBLIBEX';
  408. function WLNGetProgressValue; external 'WEBLIBEX';
  409. function WLNGetProgressMaximum; external 'WEBLIBEX';
  410. function WLNGetWindow; external 'WEBLIBEX';
  411. function WLNGetURL; external 'WEBLIBEX';
  412. function WLNGetMIMEType; external 'WEBLIBEX';
  413. function WLNGetReferrer; external 'WEBLIBEX';
  414. function WLNGetFlags; external 'WEBLIBEX';
  415. function WLNGetSaveFile; external 'WEBLIBEX';
  416. function WLNGetFormData; external 'WEBLIBEX';
  417. function WLNGetX; external 'WEBLIBEX';
  418. function WLNGetY; external 'WEBLIBEX';
  419. function WLNGetWidth; external 'WEBLIBEX';
  420. function WLNGetHeight; external 'WEBLIBEX';
  421. function WLNGetFileName; external 'WEBLIBEX';
  422. function WLNGetButtonID; external 'WEBLIBEX';
  423.  
  424. function WLStartup; external 'WEBLIB';
  425. function WLCleanup; external 'WEBLIB';
  426. function WLSetDefaultNotify; external 'WEBLIB';
  427.  
  428. function WLConnectBrowser; external 'WEBLIB';
  429. function WLDisconnectBrowser; external 'WEBLIB';
  430. function WLGetWindowInfo; external 'WEBLIB';
  431. function WLListWindows; external 'WEBLIB';
  432. function WLActivateWindow    ; external 'WEBLIB';
  433. function WLCloseWindow; external 'WEBLIB';
  434. function WLSetWindowPos; external 'WEBLIB';
  435. function WLShowWindow; external 'WEBLIB';
  436. function WLShowFile; external 'WEBLIB';
  437. function WLOpenURL; external 'WEBLIB';
  438. function WLSaveURL; external 'WEBLIB';
  439. function WLPostFormData; external 'WEBLIB';
  440. function WLSaveFormData; external 'WEBLIB';
  441. function WLCancel; external 'WEBLIB';
  442. function WLRegisterProtocol; external 'WEBLIB';
  443. function WLUnregisterProtocol; external 'WEBLIB';
  444. function WLRegisterURLEcho; external 'WEBLIB';
  445. function WLUnregisterURLEcho; external 'WEBLIB';
  446. function WLRegisterViewer; external 'WEBLIB';
  447. function WLUnregisterViewer; external 'WEBLIB';
  448. function WLRegisterWindowChange; external 'WEBLIB';
  449. function WLUnregisterWindowChange; external 'WEBLIB';
  450. function WLParseAnchor; external 'WEBLIB';
  451. function WLGetVersion; external 'WEBLIB';
  452. function WLQueryURLFile; external 'WEBLIB';
  453. function WLSetNotifyMethod; external 'WEBLIB';
  454. function WLGetTransactionWindow; external 'WEBLIB';
  455. procedure WLNSetFileName; external 'WEBLIB';
  456.  
  457. function WLCreateToolbar; external 'WEBLIB';
  458. function WLDeleteToolbar; external 'WEBLIB';
  459. function WLIsToolbarActive; external 'WEBLIB';
  460. function WLSetActiveToolbar; external 'WEBLIB';
  461. function WLAddToolbarButton; external 'WEBLIB';
  462. function WLRemoveToolbarButton; external 'WEBLIB';
  463. function WLIsToolbarButtonVisible; external 'WEBLIB';
  464. function WLShowToolbarButton; external 'WEBLIB';
  465. function WLEnableToolbarButton; external 'WEBLIB';
  466. function WLIsToolbarButtonEnabled; external 'WEBLIB';
  467. function WLGetToolbarText; external 'WEBLIB';
  468. function WLSetToolbarText; external 'WEBLIB';
  469. function WLGetToolbarFont; external 'WEBLIB';
  470. function WLSetToolbarFont; external 'WEBLIB';
  471. function WLGetToolbarBkgnd; external 'WEBLIB';
  472. function WLSetToolbarBkgnd; external 'WEBLIB';
  473. function WLGetToolbarTextColor; external 'WEBLIB';
  474. function WLSetToolbarTextColor; external 'WEBLIB';
  475.  
  476. function WLAppendFormData; external 'WEBLIB';
  477. function WLGetFormDataLength; external 'WEBLIB';
  478. function WLAccessFormData; external 'WEBLIB';
  479.  
  480. function WLAddToolbarButtonByHandle; external 'WEBLIBEX';
  481. function WLAddToolbarButtonByFile; external 'WEBLIBEX';
  482. function WLAddToolbarButtonByID; external 'WEBLIBEX';
  483. function WLAddToolbarButtonByName; external 'WEBLIBEX';
  484.  
  485. end.
  486.  
  487.